package com.qianxx.component.activity.progress.rotate_image;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.qianxx.component.R;
import com.qianxx.component.activity.base.BaseActivity;
import com.qianxx.viewlibrary.progress.rotateImageView.RotateImageView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

import static com.qianxx.viewlibrary.progress.rotateImageView.RotateImageView.STATE.START;
import static com.qianxx.viewlibrary.progress.rotateImageView.RotateImageView.STATE.STOP;

public class RotateImageActivity extends BaseActivity {
    @BindView(R.id.iv_bg)
    RotateImageView iv_bg;
    @BindView(R.id.tv_on_duty)
    TextView tv_on_duty;

    boolean isOn = true;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rotate_image);
        ButterKnife.bind(this);

        iv_bg.setAnimState(START); //开启动画
    }

    @OnClick(R.id.tv_on_duty)
    public void onClick(View v) {
        tv_on_duty.setText(isOn ? "出车" : "收车");
        iv_bg.setAnimState(isOn ? STOP : START);
        isOn = !isOn;
    }

    @Override
    public String setTitle() {
        return "RotateImage";
    }
}
